package com.xiangshizhineng.tianzhangzhi.app.common.base;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.xiangshizhineng.tianzhangzhi.app.utils.LongDateSerializer;
import com.xiangshizhineng.tianzhangzhi.app.utils.LongJsonSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;


@Data
@ApiModel(description = "DTO父类")
public class BaseDTO implements Serializable {

    /**
     * 数据库表的主键, 生成策略基于雪花算法
     * 获取示例：<code>AppContext.IdGen.nextId()</>
     */
    @ApiModelProperty(value = "主键", hidden = true)
    @JsonSerialize(using = LongJsonSerializer.class)
    private Long id;

    /**
     * 创建人ID，对应 用户表的id.
     * 获取示例：<code>BaseController#getUserId(request)</code>
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "创建人ID", hidden = true)
    @JsonSerialize(using = LongJsonSerializer.class)
    private Long createdBy;

    /**
     * 创建时间，存储时间戳。
     * 获取示例：<code>System.currentTimeMillis()</code>
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "创建时间", hidden = true)
    @JsonSerialize(using = LongDateSerializer.class)
    private Long createdDate;

    /**
     * 最后修改人ID，对应t_user表的id
     * 获取示例：<code>BaseController#getUserId(request)</code>
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "最后修改人ID", hidden = true)
    @JsonSerialize(using = LongJsonSerializer.class)
    private Long modifiedBy;

    /**
     * 最后修改时间，存储时间戳。
     * 获取示例：<code>System.currentTimeMillis()</code>
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "最后修改时间", hidden = true)
    @JsonSerialize(using = LongDateSerializer.class)
    private Long modifiedDate;

    /**
     * 此记录的状态，例如逻辑删除
     * 示例：1：正常：0：删除 等等
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "状态", hidden = true)
    private Integer status;

    /**
     * 数据最后编辑人的ip地址。
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "ip地址", hidden = true)
    private String ip;

    /**
     * 租户id
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "租户id", hidden = true)
    @JsonSerialize(using = LongJsonSerializer.class)
    private Long tenantId;



}
